//class ToCItemButton
package baidu.reader.common.ui.toc
{
    import baidu.reader.common.ui.components.*;
    import baidu.ui.containers.*;
    import flash.text.*;

    public class ToCItemButton extends baidu.ui.containers.Pane
    {
        public function ToCItemButton(arg1:String="")
        {
            super();
            this.button = new baidu.reader.common.ui.components.EllipsisLabelButton();
            this.button.height = this.fontSize + 8;
            this.button.setStyle("skin", ResourceFactory.TabRadioButton_Skin);
			this.button.setStyle("skin_up", ResourceFactory.TabRadioButton_Skin_Up);
			this.button.setStyle("skin_over", ResourceFactory.TabRadioButton_Skin_Over);
			this.button.setStyle("skin_down", ResourceFactory.TabRadioButton_Skin_Down);
			this.button.setStyle("skin_sUp", ResourceFactory.TabRadioButton_Skin_Down);
			this.button.setStyle("skin_sOver", ResourceFactory.TabRadioButton_Skin_Over);
			this.button.setStyle("skin_sDown", ResourceFactory.TabRadioButton_Skin_Down);
            this.button.setStyle("textFormat", new flash.text.TextFormat("宋体", 14, 3355443));
            this.button.autoSize = true;
            this.button.useHandCursor = true;
            this.button.textField.autoSize = flash.text.TextFieldAutoSize.LEFT;
            addChild(this.button);
            this.button.x = this.padding;
            this.graphics.beginFill(this.bulletColor);
            this.graphics.drawRect(10, 10, this.bulletSize, this.bulletSize);
            this.label = arg1;
            return;
        }

        public override function set width(arg1:Number):void
        {
            super.width = arg1;
            this.drawNow();
            this.resizeButton();
            return;
        }

        public function set label(arg1:String):void
        {
            this._text = arg1;
            this.button.label = this._text;
            this.refreshLabelColor();
            this.drawNow();
            this.resizeButton();
            return;
        }

        public function get label():String
        {
            return this._text;
        }

        private function resizeButton():void
        {
            this.button.width = this.width - this.padding;
            return;
        }

        private function refreshLabelColor():void
        {
            return;
        }

        public function get value():*
        {
            return this._value;
        }

        public function set value(arg1:*):void
        {
            this._value = arg1;
            return;
        }

        private var bulletColor:uint=7035468;

        private var bulletSize:Number=3;

        private var firstColor:uint=1118481;

        private var secondColor:uint=10450001;

        private var padding:Number=20;

        private var fontSize:int=14;

        private var _value:*;

        private var _ellipsisIndex:int=-1;

        private var _tail:String="...";

        private var _text:String;

        private var button:baidu.reader.common.ui.components.EllipsisLabelButton;
    }
}


